from activities.models import Gathering
from rest_framework import serializers


class GatheringListSerializer(serializers.ModelSerializer):
    # 活动列表
    users = serializers.PrimaryKeyRelatedField(read_only=True, many=True)

    class Meta:
        model = Gathering
        fields = ('id', 'name', 'image', 'city', 'starttime', 'endrolltime', 'users')


class GatheringDetailSerialzer(serializers.ModelSerializer):
    # 活动详情页
    users = serializers.PrimaryKeyRelatedField(read_only=True, many=True)

    class Meta:
        model = Gathering
        fields = "__all__"